const getters = {
  sidebar: (state) => state.app.sidebar,
  device: (state) => state.app.device,
  token: (state) => state.user.token,
  name: (state) => state.user.name,
  aclass: (state) => (classId = 101) => {
    const classification = state.allClass.filter((item) => {
      return item.id === classId
    })[0]
    if (classification) {
      return classification
    }
    return {
      id: 0,
      name: '信息青年',
      map: [{ id: 1, name: '信息青年' }]
    }
  },
  amap: (state, getters) => (classId, mapId) => {
    const map = getters.aclass(classId).map.filter((item) => {
      return item.id === mapId
    })[0]
    if (map) {
      return map
    }
    return {
      id: 0,
      name: '信息青年'
    }
  }
}
export default getters
